package com.lili.goods.controller;


import com.lili.common.result.Result;
import com.lili.goods.mapper.GoodsBrandMapper;
import com.lili.goods.service.GoodsBrandService;
import com.lili.model.goods.GoodsBrand;
import com.lili.common.result.Result;
import com.lili.model.goods.GoodsUnit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/goods")
@Api(tags = "商品品牌")
public class GoodsBrandController {
    @Autowired
    GoodsBrandService goodsBrandService;

    @ApiOperation("商品品牌查询")
    @GetMapping("/brand")
    public Result getGoodsBrand() {
        List<GoodsBrand> list = goodsBrandService.getBrand();
        return Result.ok(list);
    }

    @ApiOperation("商品品牌保存")
    @PostMapping("/brand")
    public Result saveGoodsBrand(@RequestBody GoodsBrand goodsBrand) {
        int i = goodsBrandService.saveBrand(goodsBrand);
        return Result.ok("保存成功" + i);
    }


    @ApiOperation("商品品牌更新")
    @PutMapping("/brand")
    public Result updateGoodsBrand(@RequestBody GoodsBrand goodsBrand) {
        int i = goodsBrandService.updateBrand(goodsBrand);
        return Result.ok("更新成功" + i);
    }


    @ApiOperation("商品品牌删除")
    @DeleteMapping("/brand")
    public Result deleteGoodsBrand(@RequestBody GoodsBrand goodsBrand) {
        int i = goodsBrandService.deleteBrand(goodsBrand);
        return Result.ok("删除成功" + i);
    }


}
